home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3867 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.chattanooga.net!usenet
  2. From: "Eric W. Bradway" <ebradway@microsports.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Recursive function -> how do you exit one?
  5. Date: Tue, 30 Jan 1996 19:00:22 -0500
  6. Organization: Micro Sports, Inc.
  7. Message-ID: <310EB116.11E@microsports.com>
  8. References: <4eh1g8$aba@pulp.ucs.ualberta.ca> <4ejbf0INN2b3@keats.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: 205.244.28.38
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b5 (Win95; I)
  14.  
  15. Kazimir Kylheku wrote:
  16. > In article <4eh1g8$aba@pulp.ucs.ualberta.ca>,
  17. > Jacob Bukczynski <jbukczyn@gpu.srv.ualberta.ca> wrote:
  18. > >I'm using a recursive function to search for files. I need
  19. > >it to quit when a user presses Esc.
  20. > >
  21. > >Using
  22. > >
  23. > >return;
  24. > >
  25. > >doesn't seem to work, the funtion runs again. ( I tested
  26. > >this by putting a printf statement in front of the return -
  27. > >it got printed over and over again. )
  28. > >
  29. > >Is there a special way of exiting a recursive function?
  30. > The Elegant Way:
  31. > ----------------
  32.  
  33. Not bad...
  34.  
  35. > The Real Way:
  36. > -------------
  37.  
  38. Ewwww...that's a GOTO!
  39.  
  40. IMHO...rewrite the function so it's not recursive.
  41.  
  42. -Eric
  43.